package com.example.androidtest;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;

public class Logining extends Activity {
	private ImageView image;
	private AnimationDrawable animationDrawable;
	private Button cencle;
	private SharedPreferences sp;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		final int time = 3000;
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_logining);

		cencle = (Button) findViewById(R.id.btn_loading);
		image = (ImageView) findViewById(R.id.loading);
		animationDrawable = (AnimationDrawable) image.getBackground();
		animationDrawable.start();
		final Handler handler = new Handler();
		final Runnable runnable = new Runnable() {
		
			@Override
			public void run() {
				Intent intent = new Intent(Logining.this, Tabhost.class);
				startActivity(intent);
				finish();
			}

		};
		handler.postDelayed(runnable, time);
	
		
		cencle.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
//				Editor editor = sp.edit();
//				sp.edit().putBoolean("login_check", false).commit();
				handler.removeCallbacks(runnable);
//				Intent intent = new Intent(Logining.this, MainActivity.class);
//				startActivity(intent);
				
				finish();
			}
		});
	}
}
